package parser

import (
	"fmt"
	"regexp"
	"wjerp.com/hello/crawler/engine"
)

const cityRe = `<a href="(http://album.zhenai.com/u/[0-9]+)"[^>]*>([^<]*)</a>`

func ParseCity(contents []byte) engine.ParseResult{
	regex := regexp.MustCompile(cityRe)
	allSubmatch := regex.FindAllSubmatch(contents, -1)
	fmt.Printf("find pepole counts:%d\n",len(allSubmatch))
	parseResult:=engine.ParseResult{}
	for _,result:= range allSubmatch{
		nickname := string(result[2])
		parseResult.Items = append(parseResult.Items,nickname)
		//parseResult.Requests = append(parseResult.Requests,engine.Request{
		//	Url: string(result[1]),
		//	ParseFunc: func(b []byte) engine.ParseResult {
		//		// return ParseProfile(b,nickname)
		//		return engine.NilParser(b)
		//	},
		//})
	}
	return parseResult

}